﻿function DialogBox(url, sTitle) 
{
	var Box = $('<div title=""></div>');
	Box.dialog
	({
		autoOpen: false,
		title: sTitle,
		bgiframe: false,
		modal: true,
		minWidth: 250,
		height: 250,
		maxWidth: 700,
		maxHeight: 650, 
		width: 650,
		height: 545,
		buttons: 
		{
		    닫기: function () 
			{
				Box.dialog('destroy');
			}
		},
		close: function() {Box.dialog('destroy');},
		open: function(event, ui) {$('<iframe style="width:100%; height:100%; border:0;" src="'+url+'" frameborder="0" ></iframe>').appendTo(Box);}
	});	
 
	Box.dialog('open');
 
	return false;
}
 
function MessageBox(url, sTitle) 
{
	$('<div title=""></div>').load
	(
		url,
		function(data)
		{
			$(this).dialog
			({
				title: sTitle,
				bgiframe: true,
				modal: true,
				minWidth: 250,
				height: 250,
				maxWidth: 700,
				maxHeight: 650, 
				width: 650,
				height: 545,
				buttons: 
				{
				    닫기: function () 
					{
						$(this).dialog('destroy');
					}
				}
			});
		}
	);
	
	return false;
}

function ViewBox(url, sTitle) 
{
	$('<div title=""></div>').load
	(
		url,
		function(data)
		{
			$(this).dialog
			({
				title: sTitle,
				bgiframe: false,
				modal: true,
				minWidth: 250,
				height: 250,
				maxWidth: 700,
				maxHeight: 650, 
				width: 650,
				height: 545,
				buttons: 
				{
				    닫기: function () 
					{
						$(this).dialog('destroy');
					}
				}
			});
		}
	);
	
	return false;
}

function ConfirmBox(content, func)
{    
    var arg = ConfirmBox.arguments;  
    var sTitle = (arg.length > 2) ? arg[2] : '확인';
    
	$("<div id='userDialog' title='"+sTitle+"'></div>").html(content).dialog
	({
		bgiframe: true,
		modal: true,
		//minWidth: 150,
		//height: 100,
		maxWidth: 550,
		maxHeight: 500, 
		buttons: 
		{
            실행: function()
			{
			    func();
			},
		    취소: function () 
		    {
		        $(this).dialog('destroy').remove();
		    }
		}
	});
	
	return false;
}
 
function AlertCallback(html, sTitle, func) 
{
	$('<div title=""></div>').html(html).dialog
	({
		title: sTitle,
		bgiframe: true,
		modal: true,
		minWidth: 250,
		height: 250,
		maxWidth: 550,
		maxHeight: 500, 
		buttons: 
		{
		    닫기: function () 
			{
				func();
				$(this).dialog('destroy');
			}
		}
	});
	
	return false;
}

function ShowMessage(content) 
{
    $("#userDialog").dialog("destroy").remove();
    var arg = ShowMessage.arguments;
    var sTitle = (arg.length > 1) ? arg[1] : '메세지';

    $("<div title='" + sTitle + "'></div>").html(content).dialog
	({
		bgiframe: false,
		modal: true,
		resizable: false,
		buttons: 
		{
			닫기: function() 
			{
				$(this).dialog('destroy').remove();
			}
		}
	});
	
	return false;
}

function AlertBox(content, sTitle) 
{
	$("<div id='alertBox'></div>").html(content).dialog
	({
		bgiframe: false,
		modal: true,
		title: sTitle,
		resizable: false,
		width: 450,
		height: 250,
		close: function() { $(this).dialog('destroy').remove(); }
	});
}

function ShowBox(content, sTitle) 
{
	$("<div></div>").html(content).dialog
	(
		{
			bgiframe: false,
			modal: true,
			draggable: true,
			title: sTitle,
			resizable: false,
			position: ['left','top'],
			closeOnEscape: false,
			close: function() { return false; }
		}		
	);
}
